
import numpy as np
from datas import datas
X=[]
Y=[]
cityMark={"吕梁":1,"太原":2}
for item in datas:
    single=[]
    # 城市
    single.append(cityMark[item["city"]])
    # 面积
    single.append(item["area"])
    # 房间数
    single.append(item["rooms"])
    #学区房
    single.append(item["school"])
#装修风格
single.append(item["style"])

X.append(single)
Y.append(item["price"])

X=np.array(X)
Y=np.array(Y)

theta=np.linalg.pinv(X.T.dot(X)).dot(X.T).dot(Y)

print(theta.dot(np.array([2,100,2,1,1])))